﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CMS.BLL;


public partial class Controls_Tour_ctrTourCatNames : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.Initdata();
        }
    }

    private void Initdata()
    {
        int nCountry = this.GetCountry();
        TourCategory objTourCat = new TourCategory();
        DataTable dtbCat = new DataTable();
        dtbCat = objTourCat.Search(0, nCountry);
        rptTour.DataSource = dtbCat;
        rptTour.DataBind();
    }

    private int GetCountry()
    {
        int nCountry = 0;
        nCountry = ConvertData.ConvertToInt(Request.QueryString[Config.COUNTRY]);
        if (nCountry == 0)
            nCountry = Config.COUNTRY_DEFAULT;
        return  nCountry;
    }



    protected void rptTour_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            int nCurrentLanguage = Support.GetCurrentLanguage();
            HyperLink lnkTourTitle = (HyperLink)e.Item.FindControl("hplTourCatName");
            lnkTourTitle.NavigateUrl = Config.ROOT + "#divTabContent" + ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "TourCategoryID"));
            switch (nCurrentLanguage)
            {
                case 1:
                    lnkTourTitle.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "TourCategoryName1"));
                    break;
                case 2:
                    lnkTourTitle.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "TourCategoryName2"));
                    break;
                case 3:
                    lnkTourTitle.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "TourCategoryName3"));
                    break;
            }
        }
    }
}